# Contributor: Eloi Torrents <eloitor@disroot.org>
# Maintainer: Eloi Torrents <eloitor@disroot.org>
pkgname=osmin
pkgver=1.8.7
pkgrel=0
_libosmscout_version=1.9.2
pkgdesc="GPS Navigator On-Road/Off-Road"
url="https://github.com/janbar/osmin"
arch="all !armhf !s390x"
# armhf: qt5-qtsensors-dev, qt5-qtlocation-dev
# s390x: openmp-dev
license="GPL-3.0-only"
makedepends="
	clang
	cmake
	libmarisa-dev
	libxml2-dev
	openmp-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsensors-dev
	qt5-qtmultimedia-dev
	qt5-qtremoteobjects-dev
	qt5-qtlocation-dev
	samurai
	"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/janbar/osmin/archive/refs/tags/$pkgver.tar.gz
	$pkgname-osmscout-$pkgver.tar.gz::https://github.com/janbar/libosmscout/archive/refs/tags/osmin-$_libosmscout_version.tar.gz
	system-libmarisa.patch
	cpp-locale.patch
	"

prepare() {
	rmdir backend/libosmscout
	mv -v ../libosmscout-$pkgname-$_libosmscout_version backend/libosmscout
	default_prepare
}


build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_C_COMPILER=clang \
		-DCMAKE_CXX_COMPILER=clang++ \
		-DCMAKE_BUILD_TYPE=Release
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2e19f7357f1c99d26f32190efc340c6302d90a124b0c78f18320b14331fcd06d1b2488c04ed5e80bcf5a1967d21a455e13b21ae7c82daff3f9ea85eb78b1a314  osmin-1.8.7.tar.gz
88538c15aee8986bbb63e68e3d970763ef5f303ac932f3e439b7ecbcf8e8cf9e958203b639d3e54e1abd068c3267bc5deaec241eeebbcd7e6e61f72484c34f7b  osmin-osmscout-1.8.7.tar.gz
07a722a1f52cc515f44b90cb7b5d6964e72d58ec4daa0d6276fa06bf7ac7ecd5ed5a241c3262922e38581e72920a88c0e5d34ff1a854877a64a1cb0b5d784828  system-libmarisa.patch
9b80f943701d790b8b6ad012234c4e36f3a76b0ccb2ed34c62082fa81488cab9d737de97062cdc59d1a74ed6a9064347bc7115af2362111f73f64505640c04a2  cpp-locale.patch
"
